<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件委托</title>
</head>

<body>
    <ul id="parent">
        <li class="child">我是1</li>
        <li class="child">我是2</li>
        <li class="child">我是3</li>
    </ul>
    <script>
        let dom = document.getElementById('parent')
        dom.onclick = function (event) {
            var event = event || window.event
            console.log("event", event)
            var currentTarget = event.target || event.srcElement
            console.log(currentTarget)
            if (currentTarget.tagName.toLowerCase() == 'li') {
                console.log('===事件处理中===')
            }
        }
    </script>
</body>

</html>